package bean;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import utils.GeneralConstants;

public class Message {
	private String command;
	private Integer code;

	private String receiver;
	private String sender;

	private String text;

	private DateTime dateTime;

	public Message() {
		dateTime = new DateTime();
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public DateTime getDateTime() {
		return dateTime;
	}

	public void setDateTime(DateTime dateTime) {
		this.dateTime = dateTime;
	}

	// methods for easier message manipulation
	public String getFormattedDateTime() {
		DateTimeFormatter formatter = DateTimeFormat
				.forPattern(GeneralConstants.DATETIME_PATTERN);
		return formatter.print(getDateTime());
	}

}
